<!--
 * @Author: liuhanzhuang
 * @Date: 2023-01-09 18:30:52
 * @Description: 文件描述
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    body {
      display: flex;
      justify-content: center;
      align-items: center;
      font-family: '猫啃网糖圆体 (测试版)';
      color: #fff;
      height: 100vh;
      background-color: #3494e4;
    }

    .inp-container {
      display: flex;
    }

    .inp-container input {
      width: 0px;
      border: 0;
      height: 40px;
      transition: all .3s ease-in;
      outline: none;
    }

    .inp-container .toggle {
      width: 200px;
      padding: 0 10px;
    }

    button {
      width: 40px;
      height: 40px;
      border: none;
    }
  </style>
</head>

<body>
  <div class="inp-container">
    <input type="text" placeholder="  please input someone..." />
    <button>搜索</button>
  </div>
</body>
<script>
  let inputEl = document.querySelector('input');
  let buttonEl = document.querySelector('button');
  buttonEl.addEventListener('click', () => {
    inputEl.classList.toggle("toggle");
    inputEl.focus();
  });
</script>

</html>